using System;
using System.Data;
using System.Linq;
using System.Data.SqlClient;

namespace Nothwind.DAL{

public partial class ActiveProductsFedaratedDataAdapter :
    System.MarshalByRefObject
 {
    public ActiveProductsFedaratedDataAdapter()
    {
        Init();
    }

    #region Generated code

    public ActiveProductsFedaratedDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public ActiveProductsFedaratedDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ProductID], [ProductName] from [ActiveProductsFedarated] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [ActiveProductsFedarated] ([ProductName]) VALUES (@ProductName); select [ProductID], [ProductName] from [ActiveProductsFedarated]  where [ProductID] = SCOPE_IDENTITY()";
        
        p = InsertCommand.Parameters.Add("@ProductName", SqlDbType.NVarChar);
        p.SourceColumn = "ProductName";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [ActiveProductsFedarated] SET [ProductName] = @ProductName WHERE (([ProductID] = @Original_ProductID)); select [ProductID], [ProductName] from [ActiveProductsFedarated]  where [ProductID] = SCOPE_IDENTITY()";
        
        p = UpdateCommand.Parameters.Add("@ProductName", SqlDbType.NVarChar);
        p.SourceColumn = "ProductName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [ActiveProductsFedarated] WHERE (([ProductID] = @Original_ProductID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class AddressSplitDataAdapter :
    System.MarshalByRefObject
 {
    public AddressSplitDataAdapter()
    {
        Init();
    }

    #region Generated code

    public AddressSplitDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public AddressSplitDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ID], [Address], [City], [Region], [PostalCode], [Country], [ContactType] from [AddressSplit] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [AddressSplit] ([ID], [Address], [City], [Region], [PostalCode], [Country], [ContactType]) VALUES (@ID, @Address, @City, @Region, @PostalCode, @Country, @ContactType); select [ID], [Address], [City], [Region], [PostalCode], [Country], [ContactType] from [AddressSplit]  where [ID] = @ID";
        
        p = InsertCommand.Parameters.Add("@ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactType", SqlDbType.NVarChar);
        p.SourceColumn = "ContactType";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [AddressSplit] SET [ID] = @ID, [Address] = @Address, [City] = @City, [Region] = @Region, [PostalCode] = @PostalCode, [Country] = @Country, [ContactType] = @ContactType WHERE (([ID] = @Original_ID)); select [ID], [Address], [City], [Region], [PostalCode], [Country], [ContactType] from [AddressSplit]  where [ID] = @ID";
        
        p = UpdateCommand.Parameters.Add("@ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactType", SqlDbType.NVarChar);
        p.SourceColumn = "ContactType";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [AddressSplit] WHERE (([ID] = @Original_ID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class BaseContactSplitDataAdapter :
    System.MarshalByRefObject
 {
    public BaseContactSplitDataAdapter()
    {
        Init();
    }

    #region Generated code

    public BaseContactSplitDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public BaseContactSplitDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ID], [CompanyName], [ContactName], [Phone], [ContactType] from [BaseContactSplit] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [BaseContactSplit] ([ID], [CompanyName], [ContactName], [Phone], [ContactType]) VALUES (@ID, @CompanyName, @ContactName, @Phone, @ContactType); select [ID], [CompanyName], [ContactName], [Phone], [ContactType] from [BaseContactSplit]  where [ID] = @ID";
        
        p = InsertCommand.Parameters.Add("@ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactName", SqlDbType.NVarChar);
        p.SourceColumn = "ContactName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactType", SqlDbType.NVarChar);
        p.SourceColumn = "ContactType";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [BaseContactSplit] SET [ID] = @ID, [CompanyName] = @CompanyName, [ContactName] = @ContactName, [Phone] = @Phone, [ContactType] = @ContactType WHERE (([ID] = @Original_ID)); select [ID], [CompanyName], [ContactName], [Phone], [ContactType] from [BaseContactSplit]  where [ID] = @ID";
        
        p = UpdateCommand.Parameters.Add("@ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactName", SqlDbType.NVarChar);
        p.SourceColumn = "ContactName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactType", SqlDbType.NVarChar);
        p.SourceColumn = "ContactType";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [BaseContactSplit] WHERE (([ID] = @Original_ID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class BaseProductsFedaratedDataAdapter :
    System.MarshalByRefObject
 {
    public BaseProductsFedaratedDataAdapter()
    {
        Init();
    }

    #region Generated code

    public BaseProductsFedaratedDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public BaseProductsFedaratedDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ProductID], [ProductName] from [BaseProductsFedarated] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [BaseProductsFedarated] ([ProductID], [ProductName]) VALUES (@ProductID, @ProductName); select [ProductID], [ProductName] from [BaseProductsFedarated]  where [ProductID] = @ProductID";
        
        p = InsertCommand.Parameters.Add("@ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ProductName", SqlDbType.NVarChar);
        p.SourceColumn = "ProductName";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [BaseProductsFedarated] SET [ProductID] = @ProductID, [ProductName] = @ProductName WHERE (([ProductID] = @Original_ProductID)); select [ProductID], [ProductName] from [BaseProductsFedarated]  where [ProductID] = @ProductID";
        
        p = UpdateCommand.Parameters.Add("@ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ProductName", SqlDbType.NVarChar);
        p.SourceColumn = "ProductName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [BaseProductsFedarated] WHERE (([ProductID] = @Original_ProductID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class CategoriesDataAdapter :
    System.MarshalByRefObject
 {
    public CategoriesDataAdapter()
    {
        Init();
    }

    #region Generated code

    public CategoriesDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public CategoriesDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [CategoryID], [CategoryName], [Description], [Picture] from [Categories] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Categories] ([CategoryName], [Description], [Picture]) VALUES (@CategoryName, @Description, @Picture); select [CategoryID], [CategoryName], [Description], [Picture] from [Categories]  where [CategoryID] = SCOPE_IDENTITY()";
        
        p = InsertCommand.Parameters.Add("@CategoryName", SqlDbType.NVarChar);
        p.SourceColumn = "CategoryName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Description", SqlDbType.NText);
        p.SourceColumn = "Description";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Picture", SqlDbType.Image);
        p.SourceColumn = "Picture";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Categories] SET [CategoryName] = @CategoryName, [Description] = @Description, [Picture] = @Picture WHERE (([CategoryID] = @Original_CategoryID)); select [CategoryID], [CategoryName], [Description], [Picture] from [Categories]  where [CategoryID] = SCOPE_IDENTITY()";
        
        p = UpdateCommand.Parameters.Add("@CategoryName", SqlDbType.NVarChar);
        p.SourceColumn = "CategoryName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Description", SqlDbType.NText);
        p.SourceColumn = "Description";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Picture", SqlDbType.Image);
        p.SourceColumn = "Picture";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_CategoryID", SqlDbType.Int);
        p.SourceColumn = "CategoryID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Categories] WHERE (([CategoryID] = @Original_CategoryID))";
        
        p = DeleteCommand.Parameters.Add("@Original_CategoryID", SqlDbType.Int);
        p.SourceColumn = "CategoryID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class ContactNameSplitDataAdapter :
    System.MarshalByRefObject
 {
    public ContactNameSplitDataAdapter()
    {
        Init();
    }

    #region Generated code

    public ContactNameSplitDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public ContactNameSplitDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ID], [Name], [Title], [Fax], [ContactType] from [ContactNameSplit] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [ContactNameSplit] ([ID], [Name], [Title], [Fax], [ContactType]) VALUES (@ID, @Name, @Title, @Fax, @ContactType); select [ID], [Name], [Title], [Fax], [ContactType] from [ContactNameSplit]  where [ID] = @ID";
        
        p = InsertCommand.Parameters.Add("@ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Name", SqlDbType.NVarChar);
        p.SourceColumn = "Name";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Title", SqlDbType.NVarChar);
        p.SourceColumn = "Title";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Fax", SqlDbType.NVarChar);
        p.SourceColumn = "Fax";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactType", SqlDbType.NVarChar);
        p.SourceColumn = "ContactType";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [ContactNameSplit] SET [ID] = @ID, [Name] = @Name, [Title] = @Title, [Fax] = @Fax, [ContactType] = @ContactType WHERE (([ID] = @Original_ID)); select [ID], [Name], [Title], [Fax], [ContactType] from [ContactNameSplit]  where [ID] = @ID";
        
        p = UpdateCommand.Parameters.Add("@ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Name", SqlDbType.NVarChar);
        p.SourceColumn = "Name";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Title", SqlDbType.NVarChar);
        p.SourceColumn = "Title";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Fax", SqlDbType.NVarChar);
        p.SourceColumn = "Fax";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactType", SqlDbType.NVarChar);
        p.SourceColumn = "ContactType";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [ContactNameSplit] WHERE (([ID] = @Original_ID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class ContactsDataAdapter :
    System.MarshalByRefObject
 {
    public ContactsDataAdapter()
    {
        Init();
    }

    #region Generated code

    public ContactsDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public ContactsDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ContactID], [ContactType], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Extension], [Fax], [HomePage], [PhotoPath], [Photo] from [Contacts] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Contacts] ([ContactType], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Extension], [Fax], [HomePage], [PhotoPath], [Photo]) VALUES (@ContactType, @CompanyName, @ContactName, @ContactTitle, @Address, @City, @Region, @PostalCode, @Country, @Phone, @Extension, @Fax, @HomePage, @PhotoPath, @Photo); select [ContactID], [ContactType], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Extension], [Fax], [HomePage], [PhotoPath], [Photo] from [Contacts]  where [ContactID] = SCOPE_IDENTITY()";
        
        p = InsertCommand.Parameters.Add("@ContactType", SqlDbType.NVarChar);
        p.SourceColumn = "ContactType";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactName", SqlDbType.NVarChar);
        p.SourceColumn = "ContactName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactTitle", SqlDbType.NVarChar);
        p.SourceColumn = "ContactTitle";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Extension", SqlDbType.NVarChar);
        p.SourceColumn = "Extension";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Fax", SqlDbType.NVarChar);
        p.SourceColumn = "Fax";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@HomePage", SqlDbType.NText);
        p.SourceColumn = "HomePage";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@PhotoPath", SqlDbType.NVarChar);
        p.SourceColumn = "PhotoPath";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Photo", SqlDbType.Image);
        p.SourceColumn = "Photo";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Contacts] SET [ContactType] = @ContactType, [CompanyName] = @CompanyName, [ContactName] = @ContactName, [ContactTitle] = @ContactTitle, [Address] = @Address, [City] = @City, [Region] = @Region, [PostalCode] = @PostalCode, [Country] = @Country, [Phone] = @Phone, [Extension] = @Extension, [Fax] = @Fax, [HomePage] = @HomePage, [PhotoPath] = @PhotoPath, [Photo] = @Photo WHERE (([ContactID] = @Original_ContactID)); select [ContactID], [ContactType], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Extension], [Fax], [HomePage], [PhotoPath], [Photo] from [Contacts]  where [ContactID] = SCOPE_IDENTITY()";
        
        p = UpdateCommand.Parameters.Add("@ContactType", SqlDbType.NVarChar);
        p.SourceColumn = "ContactType";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactName", SqlDbType.NVarChar);
        p.SourceColumn = "ContactName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactTitle", SqlDbType.NVarChar);
        p.SourceColumn = "ContactTitle";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Extension", SqlDbType.NVarChar);
        p.SourceColumn = "Extension";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Fax", SqlDbType.NVarChar);
        p.SourceColumn = "Fax";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@HomePage", SqlDbType.NText);
        p.SourceColumn = "HomePage";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@PhotoPath", SqlDbType.NVarChar);
        p.SourceColumn = "PhotoPath";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Photo", SqlDbType.Image);
        p.SourceColumn = "Photo";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ContactID", SqlDbType.Int);
        p.SourceColumn = "ContactID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Contacts] WHERE (([ContactID] = @Original_ContactID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ContactID", SqlDbType.Int);
        p.SourceColumn = "ContactID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class CustomerCustomerDemoDataAdapter :
    System.MarshalByRefObject
 {
    public CustomerCustomerDemoDataAdapter()
    {
        Init();
    }

    #region Generated code

    public CustomerCustomerDemoDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public CustomerCustomerDemoDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [CustomerID], [CustomerTypeID] from [CustomerCustomerDemo] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [CustomerCustomerDemo] ([CustomerID], [CustomerTypeID]) VALUES (@CustomerID, @CustomerTypeID); select [CustomerID], [CustomerTypeID] from [CustomerCustomerDemo]  where [CustomerID] = @CustomerID AND [CustomerTypeID] = @CustomerTypeID";
        
        p = InsertCommand.Parameters.Add("@CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@CustomerTypeID", SqlDbType.NChar);
        p.SourceColumn = "CustomerTypeID";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [CustomerCustomerDemo] SET [CustomerID] = @CustomerID, [CustomerTypeID] = @CustomerTypeID WHERE (([CustomerID] = @Original_CustomerID) AND ([CustomerTypeID] = @Original_CustomerTypeID)); select [CustomerID], [CustomerTypeID] from [CustomerCustomerDemo]  where [CustomerID] = @CustomerID AND [CustomerTypeID] = @CustomerTypeID";
        
        p = UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@CustomerTypeID", SqlDbType.NChar);
        p.SourceColumn = "CustomerTypeID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Original;
        p = UpdateCommand.Parameters.Add("@Original_CustomerTypeID", SqlDbType.NChar);
        p.SourceColumn = "CustomerTypeID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [CustomerCustomerDemo] WHERE (([CustomerID] = @Original_CustomerID) AND ([CustomerTypeID] = @Original_CustomerTypeID))";
        
        p = DeleteCommand.Parameters.Add("@Original_CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Original;
        p = DeleteCommand.Parameters.Add("@Original_CustomerTypeID", SqlDbType.NChar);
        p.SourceColumn = "CustomerTypeID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class CustomerDemographicsDataAdapter :
    System.MarshalByRefObject
 {
    public CustomerDemographicsDataAdapter()
    {
        Init();
    }

    #region Generated code

    public CustomerDemographicsDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public CustomerDemographicsDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [CustomerTypeID], [CustomerDesc] from [CustomerDemographics] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [CustomerDemographics] ([CustomerTypeID], [CustomerDesc]) VALUES (@CustomerTypeID, @CustomerDesc); select [CustomerTypeID], [CustomerDesc] from [CustomerDemographics]  where [CustomerTypeID] = @CustomerTypeID";
        
        p = InsertCommand.Parameters.Add("@CustomerTypeID", SqlDbType.NChar);
        p.SourceColumn = "CustomerTypeID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@CustomerDesc", SqlDbType.NText);
        p.SourceColumn = "CustomerDesc";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [CustomerDemographics] SET [CustomerTypeID] = @CustomerTypeID, [CustomerDesc] = @CustomerDesc WHERE (([CustomerTypeID] = @Original_CustomerTypeID)); select [CustomerTypeID], [CustomerDesc] from [CustomerDemographics]  where [CustomerTypeID] = @CustomerTypeID";
        
        p = UpdateCommand.Parameters.Add("@CustomerTypeID", SqlDbType.NChar);
        p.SourceColumn = "CustomerTypeID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@CustomerDesc", SqlDbType.NText);
        p.SourceColumn = "CustomerDesc";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_CustomerTypeID", SqlDbType.NChar);
        p.SourceColumn = "CustomerTypeID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [CustomerDemographics] WHERE (([CustomerTypeID] = @Original_CustomerTypeID))";
        
        p = DeleteCommand.Parameters.Add("@Original_CustomerTypeID", SqlDbType.NChar);
        p.SourceColumn = "CustomerTypeID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class CustomersDataAdapter :
    System.MarshalByRefObject
 {
    public CustomersDataAdapter()
    {
        Init();
    }

    #region Generated code

    public CustomersDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public CustomersDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax] from [Customers] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Customers] ([CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax]) VALUES (@CustomerID, @CompanyName, @ContactName, @ContactTitle, @Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax); select [CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax] from [Customers]  where [CustomerID] = @CustomerID";
        
        p = InsertCommand.Parameters.Add("@CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactName", SqlDbType.NVarChar);
        p.SourceColumn = "ContactName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactTitle", SqlDbType.NVarChar);
        p.SourceColumn = "ContactTitle";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Fax", SqlDbType.NVarChar);
        p.SourceColumn = "Fax";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Customers] SET [CustomerID] = @CustomerID, [CompanyName] = @CompanyName, [ContactName] = @ContactName, [ContactTitle] = @ContactTitle, [Address] = @Address, [City] = @City, [Region] = @Region, [PostalCode] = @PostalCode, [Country] = @Country, [Phone] = @Phone, [Fax] = @Fax WHERE (([CustomerID] = @Original_CustomerID)); select [CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax] from [Customers]  where [CustomerID] = @CustomerID";
        
        p = UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactName", SqlDbType.NVarChar);
        p.SourceColumn = "ContactName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactTitle", SqlDbType.NVarChar);
        p.SourceColumn = "ContactTitle";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Fax", SqlDbType.NVarChar);
        p.SourceColumn = "Fax";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Customers] WHERE (([CustomerID] = @Original_CustomerID))";
        
        p = DeleteCommand.Parameters.Add("@Original_CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class DiscontinuedProductsFedaratedDataAdapter :
    System.MarshalByRefObject
 {
    public DiscontinuedProductsFedaratedDataAdapter()
    {
        Init();
    }

    #region Generated code

    public DiscontinuedProductsFedaratedDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public DiscontinuedProductsFedaratedDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ProductID], [ProductName] from [DiscontinuedProductsFedarated] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [DiscontinuedProductsFedarated] ([ProductID], [ProductName]) VALUES (@ProductID, @ProductName); select [ProductID], [ProductName] from [DiscontinuedProductsFedarated]  where [ProductID] = @ProductID";
        
        p = InsertCommand.Parameters.Add("@ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ProductName", SqlDbType.NVarChar);
        p.SourceColumn = "ProductName";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [DiscontinuedProductsFedarated] SET [ProductID] = @ProductID, [ProductName] = @ProductName WHERE (([ProductID] = @Original_ProductID)); select [ProductID], [ProductName] from [DiscontinuedProductsFedarated]  where [ProductID] = @ProductID";
        
        p = UpdateCommand.Parameters.Add("@ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ProductName", SqlDbType.NVarChar);
        p.SourceColumn = "ProductName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [DiscontinuedProductsFedarated] WHERE (([ProductID] = @Original_ProductID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class EmployeesDataAdapter :
    System.MarshalByRefObject
 {
    public EmployeesDataAdapter()
    {
        Init();
    }

    #region Generated code

    public EmployeesDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public EmployeesDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [EmployeeID], [LastName], [FirstName], [Title], [TitleOfCourtesy], [BirthDate], [HireDate], [Address], [City], [Region], [PostalCode], [Country], [HomePhone], [Extension], [Photo], [Notes], [ReportsTo], [PhotoPath] from [Employees] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Employees] ([LastName], [FirstName], [Title], [TitleOfCourtesy], [BirthDate], [HireDate], [Address], [City], [Region], [PostalCode], [Country], [HomePhone], [Extension], [Photo], [Notes], [ReportsTo], [PhotoPath]) VALUES (@LastName, @FirstName, @Title, @TitleOfCourtesy, @BirthDate, @HireDate, @Address, @City, @Region, @PostalCode, @Country, @HomePhone, @Extension, @Photo, @Notes, @ReportsTo, @PhotoPath); select [EmployeeID], [LastName], [FirstName], [Title], [TitleOfCourtesy], [BirthDate], [HireDate], [Address], [City], [Region], [PostalCode], [Country], [HomePhone], [Extension], [Photo], [Notes], [ReportsTo], [PhotoPath] from [Employees]  where [EmployeeID] = SCOPE_IDENTITY()";
        
        p = InsertCommand.Parameters.Add("@LastName", SqlDbType.NVarChar);
        p.SourceColumn = "LastName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@FirstName", SqlDbType.NVarChar);
        p.SourceColumn = "FirstName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Title", SqlDbType.NVarChar);
        p.SourceColumn = "Title";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@TitleOfCourtesy", SqlDbType.NVarChar);
        p.SourceColumn = "TitleOfCourtesy";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@BirthDate", SqlDbType.DateTime);
        p.SourceColumn = "BirthDate";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@HireDate", SqlDbType.DateTime);
        p.SourceColumn = "HireDate";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@HomePhone", SqlDbType.NVarChar);
        p.SourceColumn = "HomePhone";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Extension", SqlDbType.NVarChar);
        p.SourceColumn = "Extension";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Photo", SqlDbType.Image);
        p.SourceColumn = "Photo";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Notes", SqlDbType.NText);
        p.SourceColumn = "Notes";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ReportsTo", SqlDbType.Int);
        p.SourceColumn = "ReportsTo";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@PhotoPath", SqlDbType.NVarChar);
        p.SourceColumn = "PhotoPath";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Employees] SET [LastName] = @LastName, [FirstName] = @FirstName, [Title] = @Title, [TitleOfCourtesy] = @TitleOfCourtesy, [BirthDate] = @BirthDate, [HireDate] = @HireDate, [Address] = @Address, [City] = @City, [Region] = @Region, [PostalCode] = @PostalCode, [Country] = @Country, [HomePhone] = @HomePhone, [Extension] = @Extension, [Photo] = @Photo, [Notes] = @Notes, [ReportsTo] = @ReportsTo, [PhotoPath] = @PhotoPath WHERE (([EmployeeID] = @Original_EmployeeID)); select [EmployeeID], [LastName], [FirstName], [Title], [TitleOfCourtesy], [BirthDate], [HireDate], [Address], [City], [Region], [PostalCode], [Country], [HomePhone], [Extension], [Photo], [Notes], [ReportsTo], [PhotoPath] from [Employees]  where [EmployeeID] = SCOPE_IDENTITY()";
        
        p = UpdateCommand.Parameters.Add("@LastName", SqlDbType.NVarChar);
        p.SourceColumn = "LastName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@FirstName", SqlDbType.NVarChar);
        p.SourceColumn = "FirstName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Title", SqlDbType.NVarChar);
        p.SourceColumn = "Title";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@TitleOfCourtesy", SqlDbType.NVarChar);
        p.SourceColumn = "TitleOfCourtesy";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@BirthDate", SqlDbType.DateTime);
        p.SourceColumn = "BirthDate";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@HireDate", SqlDbType.DateTime);
        p.SourceColumn = "HireDate";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@HomePhone", SqlDbType.NVarChar);
        p.SourceColumn = "HomePhone";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Extension", SqlDbType.NVarChar);
        p.SourceColumn = "Extension";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Photo", SqlDbType.Image);
        p.SourceColumn = "Photo";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Notes", SqlDbType.NText);
        p.SourceColumn = "Notes";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ReportsTo", SqlDbType.Int);
        p.SourceColumn = "ReportsTo";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@PhotoPath", SqlDbType.NVarChar);
        p.SourceColumn = "PhotoPath";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_EmployeeID", SqlDbType.Int);
        p.SourceColumn = "EmployeeID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Employees] WHERE (([EmployeeID] = @Original_EmployeeID))";
        
        p = DeleteCommand.Parameters.Add("@Original_EmployeeID", SqlDbType.Int);
        p.SourceColumn = "EmployeeID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class EmployeeSplitDataAdapter :
    System.MarshalByRefObject
 {
    public EmployeeSplitDataAdapter()
    {
        Init();
    }

    #region Generated code

    public EmployeeSplitDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public EmployeeSplitDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ID], [Extension], [PhotoPath] from [EmployeeSplit] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [EmployeeSplit] ([ID], [Extension], [PhotoPath]) VALUES (@ID, @Extension, @PhotoPath); select [ID], [Extension], [PhotoPath] from [EmployeeSplit]  where [ID] = @ID";
        
        p = InsertCommand.Parameters.Add("@ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Extension", SqlDbType.NVarChar);
        p.SourceColumn = "Extension";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@PhotoPath", SqlDbType.NVarChar);
        p.SourceColumn = "PhotoPath";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [EmployeeSplit] SET [ID] = @ID, [Extension] = @Extension, [PhotoPath] = @PhotoPath WHERE (([ID] = @Original_ID)); select [ID], [Extension], [PhotoPath] from [EmployeeSplit]  where [ID] = @ID";
        
        p = UpdateCommand.Parameters.Add("@ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Extension", SqlDbType.NVarChar);
        p.SourceColumn = "Extension";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@PhotoPath", SqlDbType.NVarChar);
        p.SourceColumn = "PhotoPath";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [EmployeeSplit] WHERE (([ID] = @Original_ID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class EmployeeTerritoriesDataAdapter :
    System.MarshalByRefObject
 {
    public EmployeeTerritoriesDataAdapter()
    {
        Init();
    }

    #region Generated code

    public EmployeeTerritoriesDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public EmployeeTerritoriesDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [EmployeeID], [TerritoryID] from [EmployeeTerritories] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [EmployeeTerritories] ([EmployeeID], [TerritoryID]) VALUES (@EmployeeID, @TerritoryID); select [EmployeeID], [TerritoryID] from [EmployeeTerritories]  where [EmployeeID] = @EmployeeID AND [TerritoryID] = @TerritoryID";
        
        p = InsertCommand.Parameters.Add("@EmployeeID", SqlDbType.Int);
        p.SourceColumn = "EmployeeID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@TerritoryID", SqlDbType.NVarChar);
        p.SourceColumn = "TerritoryID";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [EmployeeTerritories] SET [EmployeeID] = @EmployeeID, [TerritoryID] = @TerritoryID WHERE (([EmployeeID] = @Original_EmployeeID) AND ([TerritoryID] = @Original_TerritoryID)); select [EmployeeID], [TerritoryID] from [EmployeeTerritories]  where [EmployeeID] = @EmployeeID AND [TerritoryID] = @TerritoryID";
        
        p = UpdateCommand.Parameters.Add("@EmployeeID", SqlDbType.Int);
        p.SourceColumn = "EmployeeID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@TerritoryID", SqlDbType.NVarChar);
        p.SourceColumn = "TerritoryID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_EmployeeID", SqlDbType.Int);
        p.SourceColumn = "EmployeeID";
        p.SourceVersion = DataRowVersion.Original;
        p = UpdateCommand.Parameters.Add("@Original_TerritoryID", SqlDbType.NVarChar);
        p.SourceColumn = "TerritoryID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [EmployeeTerritories] WHERE (([EmployeeID] = @Original_EmployeeID) AND ([TerritoryID] = @Original_TerritoryID))";
        
        p = DeleteCommand.Parameters.Add("@Original_EmployeeID", SqlDbType.Int);
        p.SourceColumn = "EmployeeID";
        p.SourceVersion = DataRowVersion.Original;
        p = DeleteCommand.Parameters.Add("@Original_TerritoryID", SqlDbType.NVarChar);
        p.SourceColumn = "TerritoryID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class Order_DetailsDataAdapter :
    System.MarshalByRefObject
 {
    public Order_DetailsDataAdapter()
    {
        Init();
    }

    #region Generated code

    public Order_DetailsDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public Order_DetailsDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [OrderID], [ProductID], [UnitPrice], [Quantity], [Discount] from [Order Details] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Order Details] ([OrderID], [ProductID], [UnitPrice], [Quantity], [Discount]) VALUES (@OrderID, @ProductID, @UnitPrice, @Quantity, @Discount); select [OrderID], [ProductID], [UnitPrice], [Quantity], [Discount] from [Order Details]  where [OrderID] = @OrderID AND [ProductID] = @ProductID";
        
        p = InsertCommand.Parameters.Add("@OrderID", SqlDbType.Int);
        p.SourceColumn = "OrderID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@UnitPrice", SqlDbType.Money);
        p.SourceColumn = "UnitPrice";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Quantity", SqlDbType.SmallInt);
        p.SourceColumn = "Quantity";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Discount", SqlDbType.Real);
        p.SourceColumn = "Discount";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Order Details] SET [OrderID] = @OrderID, [ProductID] = @ProductID, [UnitPrice] = @UnitPrice, [Quantity] = @Quantity, [Discount] = @Discount WHERE (([OrderID] = @Original_OrderID) AND ([ProductID] = @Original_ProductID)); select [OrderID], [ProductID], [UnitPrice], [Quantity], [Discount] from [Order Details]  where [OrderID] = @OrderID AND [ProductID] = @ProductID";
        
        p = UpdateCommand.Parameters.Add("@OrderID", SqlDbType.Int);
        p.SourceColumn = "OrderID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@UnitPrice", SqlDbType.Money);
        p.SourceColumn = "UnitPrice";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Quantity", SqlDbType.SmallInt);
        p.SourceColumn = "Quantity";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Discount", SqlDbType.Real);
        p.SourceColumn = "Discount";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_OrderID", SqlDbType.Int);
        p.SourceColumn = "OrderID";
        p.SourceVersion = DataRowVersion.Original;
        p = UpdateCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Order Details] WHERE (([OrderID] = @Original_OrderID) AND ([ProductID] = @Original_ProductID))";
        
        p = DeleteCommand.Parameters.Add("@Original_OrderID", SqlDbType.Int);
        p.SourceColumn = "OrderID";
        p.SourceVersion = DataRowVersion.Original;
        p = DeleteCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class OrdersDataAdapter :
    System.MarshalByRefObject
 {
    public OrdersDataAdapter()
    {
        Init();
    }

    #region Generated code

    public OrdersDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public OrdersDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [OrderID], [CustomerID], [EmployeeID], [OrderDate], [RequiredDate], [ShippedDate], [ShipVia], [Freight], [ShipName], [ShipAddress], [ShipCity], [ShipRegion], [ShipPostalCode], [ShipCountry] from [Orders] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Orders] ([CustomerID], [EmployeeID], [OrderDate], [RequiredDate], [ShippedDate], [ShipVia], [Freight], [ShipName], [ShipAddress], [ShipCity], [ShipRegion], [ShipPostalCode], [ShipCountry]) VALUES (@CustomerID, @EmployeeID, @OrderDate, @RequiredDate, @ShippedDate, @ShipVia, @Freight, @ShipName, @ShipAddress, @ShipCity, @ShipRegion, @ShipPostalCode, @ShipCountry); select [OrderID], [CustomerID], [EmployeeID], [OrderDate], [RequiredDate], [ShippedDate], [ShipVia], [Freight], [ShipName], [ShipAddress], [ShipCity], [ShipRegion], [ShipPostalCode], [ShipCountry] from [Orders]  where [OrderID] = SCOPE_IDENTITY()";
        
        p = InsertCommand.Parameters.Add("@CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@EmployeeID", SqlDbType.Int);
        p.SourceColumn = "EmployeeID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@OrderDate", SqlDbType.DateTime);
        p.SourceColumn = "OrderDate";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@RequiredDate", SqlDbType.DateTime);
        p.SourceColumn = "RequiredDate";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ShippedDate", SqlDbType.DateTime);
        p.SourceColumn = "ShippedDate";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ShipVia", SqlDbType.Int);
        p.SourceColumn = "ShipVia";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Freight", SqlDbType.Money);
        p.SourceColumn = "Freight";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ShipName", SqlDbType.NVarChar);
        p.SourceColumn = "ShipName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ShipAddress", SqlDbType.NVarChar);
        p.SourceColumn = "ShipAddress";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ShipCity", SqlDbType.NVarChar);
        p.SourceColumn = "ShipCity";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ShipRegion", SqlDbType.NVarChar);
        p.SourceColumn = "ShipRegion";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ShipPostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "ShipPostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ShipCountry", SqlDbType.NVarChar);
        p.SourceColumn = "ShipCountry";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Orders] SET [CustomerID] = @CustomerID, [EmployeeID] = @EmployeeID, [OrderDate] = @OrderDate, [RequiredDate] = @RequiredDate, [ShippedDate] = @ShippedDate, [ShipVia] = @ShipVia, [Freight] = @Freight, [ShipName] = @ShipName, [ShipAddress] = @ShipAddress, [ShipCity] = @ShipCity, [ShipRegion] = @ShipRegion, [ShipPostalCode] = @ShipPostalCode, [ShipCountry] = @ShipCountry WHERE (([OrderID] = @Original_OrderID)); select [OrderID], [CustomerID], [EmployeeID], [OrderDate], [RequiredDate], [ShippedDate], [ShipVia], [Freight], [ShipName], [ShipAddress], [ShipCity], [ShipRegion], [ShipPostalCode], [ShipCountry] from [Orders]  where [OrderID] = SCOPE_IDENTITY()";
        
        p = UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.NChar);
        p.SourceColumn = "CustomerID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@EmployeeID", SqlDbType.Int);
        p.SourceColumn = "EmployeeID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@OrderDate", SqlDbType.DateTime);
        p.SourceColumn = "OrderDate";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@RequiredDate", SqlDbType.DateTime);
        p.SourceColumn = "RequiredDate";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ShippedDate", SqlDbType.DateTime);
        p.SourceColumn = "ShippedDate";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ShipVia", SqlDbType.Int);
        p.SourceColumn = "ShipVia";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Freight", SqlDbType.Money);
        p.SourceColumn = "Freight";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ShipName", SqlDbType.NVarChar);
        p.SourceColumn = "ShipName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ShipAddress", SqlDbType.NVarChar);
        p.SourceColumn = "ShipAddress";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ShipCity", SqlDbType.NVarChar);
        p.SourceColumn = "ShipCity";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ShipRegion", SqlDbType.NVarChar);
        p.SourceColumn = "ShipRegion";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ShipPostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "ShipPostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ShipCountry", SqlDbType.NVarChar);
        p.SourceColumn = "ShipCountry";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_OrderID", SqlDbType.Int);
        p.SourceColumn = "OrderID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Orders] WHERE (([OrderID] = @Original_OrderID))";
        
        p = DeleteCommand.Parameters.Add("@Original_OrderID", SqlDbType.Int);
        p.SourceColumn = "OrderID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class ProductsDataAdapter :
    System.MarshalByRefObject
 {
    public ProductsDataAdapter()
    {
        Init();
    }

    #region Generated code

    public ProductsDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public ProductsDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ProductID], [ProductName], [SupplierID], [CategoryID], [QuantityPerUnit], [UnitPrice], [UnitsInStock], [UnitsOnOrder], [ReorderLevel], [Discontinued] from [Products] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Products] ([ProductName], [SupplierID], [CategoryID], [QuantityPerUnit], [UnitPrice], [UnitsInStock], [UnitsOnOrder], [ReorderLevel], [Discontinued]) VALUES (@ProductName, @SupplierID, @CategoryID, @QuantityPerUnit, @UnitPrice, @UnitsInStock, @UnitsOnOrder, @ReorderLevel, @Discontinued); select [ProductID], [ProductName], [SupplierID], [CategoryID], [QuantityPerUnit], [UnitPrice], [UnitsInStock], [UnitsOnOrder], [ReorderLevel], [Discontinued] from [Products]  where [ProductID] = SCOPE_IDENTITY()";
        
        p = InsertCommand.Parameters.Add("@ProductName", SqlDbType.NVarChar);
        p.SourceColumn = "ProductName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@SupplierID", SqlDbType.Int);
        p.SourceColumn = "SupplierID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@CategoryID", SqlDbType.Int);
        p.SourceColumn = "CategoryID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@QuantityPerUnit", SqlDbType.NVarChar);
        p.SourceColumn = "QuantityPerUnit";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@UnitPrice", SqlDbType.Money);
        p.SourceColumn = "UnitPrice";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@UnitsInStock", SqlDbType.SmallInt);
        p.SourceColumn = "UnitsInStock";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@UnitsOnOrder", SqlDbType.SmallInt);
        p.SourceColumn = "UnitsOnOrder";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ReorderLevel", SqlDbType.SmallInt);
        p.SourceColumn = "ReorderLevel";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Discontinued", SqlDbType.Bit);
        p.SourceColumn = "Discontinued";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Products] SET [ProductName] = @ProductName, [SupplierID] = @SupplierID, [CategoryID] = @CategoryID, [QuantityPerUnit] = @QuantityPerUnit, [UnitPrice] = @UnitPrice, [UnitsInStock] = @UnitsInStock, [UnitsOnOrder] = @UnitsOnOrder, [ReorderLevel] = @ReorderLevel, [Discontinued] = @Discontinued WHERE (([ProductID] = @Original_ProductID)); select [ProductID], [ProductName], [SupplierID], [CategoryID], [QuantityPerUnit], [UnitPrice], [UnitsInStock], [UnitsOnOrder], [ReorderLevel], [Discontinued] from [Products]  where [ProductID] = SCOPE_IDENTITY()";
        
        p = UpdateCommand.Parameters.Add("@ProductName", SqlDbType.NVarChar);
        p.SourceColumn = "ProductName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@SupplierID", SqlDbType.Int);
        p.SourceColumn = "SupplierID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@CategoryID", SqlDbType.Int);
        p.SourceColumn = "CategoryID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@QuantityPerUnit", SqlDbType.NVarChar);
        p.SourceColumn = "QuantityPerUnit";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@UnitPrice", SqlDbType.Money);
        p.SourceColumn = "UnitPrice";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@UnitsInStock", SqlDbType.SmallInt);
        p.SourceColumn = "UnitsInStock";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@UnitsOnOrder", SqlDbType.SmallInt);
        p.SourceColumn = "UnitsOnOrder";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ReorderLevel", SqlDbType.SmallInt);
        p.SourceColumn = "ReorderLevel";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Discontinued", SqlDbType.Bit);
        p.SourceColumn = "Discontinued";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Products] WHERE (([ProductID] = @Original_ProductID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ProductID", SqlDbType.Int);
        p.SourceColumn = "ProductID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class RegionDataAdapter :
    System.MarshalByRefObject
 {
    public RegionDataAdapter()
    {
        Init();
    }

    #region Generated code

    public RegionDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public RegionDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [RegionID], [RegionDescription] from [Region] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Region] ([RegionID], [RegionDescription]) VALUES (@RegionID, @RegionDescription); select [RegionID], [RegionDescription] from [Region]  where [RegionID] = @RegionID";
        
        p = InsertCommand.Parameters.Add("@RegionID", SqlDbType.Int);
        p.SourceColumn = "RegionID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@RegionDescription", SqlDbType.NChar);
        p.SourceColumn = "RegionDescription";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Region] SET [RegionID] = @RegionID, [RegionDescription] = @RegionDescription WHERE (([RegionID] = @Original_RegionID)); select [RegionID], [RegionDescription] from [Region]  where [RegionID] = @RegionID";
        
        p = UpdateCommand.Parameters.Add("@RegionID", SqlDbType.Int);
        p.SourceColumn = "RegionID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@RegionDescription", SqlDbType.NChar);
        p.SourceColumn = "RegionDescription";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_RegionID", SqlDbType.Int);
        p.SourceColumn = "RegionID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Region] WHERE (([RegionID] = @Original_RegionID))";
        
        p = DeleteCommand.Parameters.Add("@Original_RegionID", SqlDbType.Int);
        p.SourceColumn = "RegionID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class ShippersDataAdapter :
    System.MarshalByRefObject
 {
    public ShippersDataAdapter()
    {
        Init();
    }

    #region Generated code

    public ShippersDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public ShippersDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ShipperID], [CompanyName], [Phone] from [Shippers] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Shippers] ([CompanyName], [Phone]) VALUES (@CompanyName, @Phone); select [ShipperID], [CompanyName], [Phone] from [Shippers]  where [ShipperID] = SCOPE_IDENTITY()";
        
        p = InsertCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Shippers] SET [CompanyName] = @CompanyName, [Phone] = @Phone WHERE (([ShipperID] = @Original_ShipperID)); select [ShipperID], [CompanyName], [Phone] from [Shippers]  where [ShipperID] = SCOPE_IDENTITY()";
        
        p = UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ShipperID", SqlDbType.Int);
        p.SourceColumn = "ShipperID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Shippers] WHERE (([ShipperID] = @Original_ShipperID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ShipperID", SqlDbType.Int);
        p.SourceColumn = "ShipperID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class SuppliersDataAdapter :
    System.MarshalByRefObject
 {
    public SuppliersDataAdapter()
    {
        Init();
    }

    #region Generated code

    public SuppliersDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public SuppliersDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [SupplierID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax], [HomePage] from [Suppliers] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Suppliers] ([CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax], [HomePage]) VALUES (@CompanyName, @ContactName, @ContactTitle, @Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax, @HomePage); select [SupplierID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax], [HomePage] from [Suppliers]  where [SupplierID] = SCOPE_IDENTITY()";
        
        p = InsertCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactName", SqlDbType.NVarChar);
        p.SourceColumn = "ContactName";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@ContactTitle", SqlDbType.NVarChar);
        p.SourceColumn = "ContactTitle";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Fax", SqlDbType.NVarChar);
        p.SourceColumn = "Fax";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@HomePage", SqlDbType.NText);
        p.SourceColumn = "HomePage";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Suppliers] SET [CompanyName] = @CompanyName, [ContactName] = @ContactName, [ContactTitle] = @ContactTitle, [Address] = @Address, [City] = @City, [Region] = @Region, [PostalCode] = @PostalCode, [Country] = @Country, [Phone] = @Phone, [Fax] = @Fax, [HomePage] = @HomePage WHERE (([SupplierID] = @Original_SupplierID)); select [SupplierID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax], [HomePage] from [Suppliers]  where [SupplierID] = SCOPE_IDENTITY()";
        
        p = UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar);
        p.SourceColumn = "CompanyName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactName", SqlDbType.NVarChar);
        p.SourceColumn = "ContactName";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@ContactTitle", SqlDbType.NVarChar);
        p.SourceColumn = "ContactTitle";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Address", SqlDbType.NVarChar);
        p.SourceColumn = "Address";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@City", SqlDbType.NVarChar);
        p.SourceColumn = "City";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Region", SqlDbType.NVarChar);
        p.SourceColumn = "Region";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@PostalCode", SqlDbType.NVarChar);
        p.SourceColumn = "PostalCode";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Country", SqlDbType.NVarChar);
        p.SourceColumn = "Country";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Phone", SqlDbType.NVarChar);
        p.SourceColumn = "Phone";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Fax", SqlDbType.NVarChar);
        p.SourceColumn = "Fax";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@HomePage", SqlDbType.NText);
        p.SourceColumn = "HomePage";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_SupplierID", SqlDbType.Int);
        p.SourceColumn = "SupplierID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Suppliers] WHERE (([SupplierID] = @Original_SupplierID))";
        
        p = DeleteCommand.Parameters.Add("@Original_SupplierID", SqlDbType.Int);
        p.SourceColumn = "SupplierID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class TerritoriesDataAdapter :
    System.MarshalByRefObject
 {
    public TerritoriesDataAdapter()
    {
        Init();
    }

    #region Generated code

    public TerritoriesDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public TerritoriesDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [TerritoryID], [TerritoryDescription], [RegionID] from [Territories] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Territories] ([TerritoryID], [TerritoryDescription], [RegionID]) VALUES (@TerritoryID, @TerritoryDescription, @RegionID); select [TerritoryID], [TerritoryDescription], [RegionID] from [Territories]  where [TerritoryID] = @TerritoryID";
        
        p = InsertCommand.Parameters.Add("@TerritoryID", SqlDbType.NVarChar);
        p.SourceColumn = "TerritoryID";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@TerritoryDescription", SqlDbType.NChar);
        p.SourceColumn = "TerritoryDescription";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@RegionID", SqlDbType.Int);
        p.SourceColumn = "RegionID";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Territories] SET [TerritoryID] = @TerritoryID, [TerritoryDescription] = @TerritoryDescription, [RegionID] = @RegionID WHERE (([TerritoryID] = @Original_TerritoryID)); select [TerritoryID], [TerritoryDescription], [RegionID] from [Territories]  where [TerritoryID] = @TerritoryID";
        
        p = UpdateCommand.Parameters.Add("@TerritoryID", SqlDbType.NVarChar);
        p.SourceColumn = "TerritoryID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@TerritoryDescription", SqlDbType.NChar);
        p.SourceColumn = "TerritoryDescription";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@RegionID", SqlDbType.Int);
        p.SourceColumn = "RegionID";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_TerritoryID", SqlDbType.NVarChar);
        p.SourceColumn = "TerritoryID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Territories] WHERE (([TerritoryID] = @Original_TerritoryID))";
        
        p = DeleteCommand.Parameters.Add("@Original_TerritoryID", SqlDbType.NVarChar);
        p.SourceColumn = "TerritoryID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      
public partial class TestDataAdapter :
    System.MarshalByRefObject
 {
    public TestDataAdapter()
    {
        Init();
    }

    #region Generated code

    public TestDataAdapter(SqlConnection connection)
    {
        Init();
        Connection = connection;
    }

    public TestDataAdapter(SqlConnection connection, SqlTransaction transaction) 
    {
        Init();
        Connection = connection;
        Transaction = transaction;
    }
    

    private SqlConnection connection;

    public SqlConnection Connection
    {
        get
        {
            return connection;
        }
        set
        {
            connection = value;
            SelectCommand.Connection = value;
            InsertCommand.Connection = value;
            UpdateCommand.Connection = value;
            DeleteCommand.Connection = value;
        } 
    }

    private SqlTransaction transaction;

    public SqlTransaction Transaction
    {
        get
        {
            return transaction;
        }
        set
        {
            transaction = value;
            SelectCommand.Transaction = value;
            InsertCommand.Transaction = value;
            UpdateCommand.Transaction = value;
            DeleteCommand.Transaction = value;
        }
    }

    protected SqlDataAdapter Adapter
    {
        get; private set;
    }

    private SqlCommand selectCommand;

    public SqlCommand SelectCommand
    {
        get
        {
            return selectCommand;
        }
        private set
        {
            selectCommand = value;
        }
    }

    private SqlCommand insertCommand;

    public SqlCommand InsertCommand
    {
        get
        {
            return insertCommand;
        }
        private set
        {
            insertCommand = value;
        }
    }

    private SqlCommand updateCommand;

    public SqlCommand UpdateCommand
    {
        get
        {
            return updateCommand;
        }
        private set
        {
            updateCommand = value;
        }
    }

    private SqlCommand deleteCommand;

    public SqlCommand DeleteCommand
    {
        get
        {
            return deleteCommand;
        }
        set
        {
            deleteCommand = value;
        }
    }

    public virtual void Update(DataRow[] dataRows, bool smartUpdate)
    {
        if (dataRows == null)
            dataRows = new DataRow[0];

        if (!smartUpdate)
        {
            Adapter.Update(dataRows);
        }
        else
        {
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Deleted).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Added).ToArray());
            Adapter.Update(dataRows.Where(row => row.RowState == DataRowState.Modified).ToArray());
        }
    }

    public virtual void Update(DataRow[] dataRows)
    {
        Update(dataRows, true);
    }

    public virtual void Update(DataTable dataTable)
    {
        Update(dataTable.Rows.OfType<DataRow>().ToArray());
    }

    public virtual void Update(DataSet dataSet, String tableName)
    {
        Update(dataSet.Tables[tableName]);
    }
     
    private void Init()
    {
        Adapter = new SqlDataAdapter();
        SelectCommand = new SqlCommand();
        InsertCommand = new SqlCommand();
        UpdateCommand = new SqlCommand();
        DeleteCommand = new SqlCommand();
        Adapter.SelectCommand = SelectCommand;
        Adapter.InsertCommand = InsertCommand;
        Adapter.UpdateCommand = UpdateCommand;
        Adapter.DeleteCommand = DeleteCommand; 
        
        // UpdatedRowSource
        this.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        this.UpdateCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
        
        SqlParameter p = null;
        // SelectCommand
        this.SelectCommand.CommandText = "select [ID], [Price], [Quantity], [Total] from [Test] where 0 = 1 ";
        

        // InsertCommand
        this.InsertCommand.CommandText = "INSERT INTO [Test] ([Price], [Quantity]) VALUES (@Price, @Quantity); select [ID], [Price], [Quantity], [Total] from [Test]  where [ID] = SCOPE_IDENTITY()";
        
        p = InsertCommand.Parameters.Add("@Price", SqlDbType.Money);
        p.SourceColumn = "Price";
        p.SourceVersion = DataRowVersion.Current;
        p = InsertCommand.Parameters.Add("@Quantity", SqlDbType.Money);
        p.SourceColumn = "Quantity";
        p.SourceVersion = DataRowVersion.Current;

        // UpdateCommand
        this.UpdateCommand.CommandText = "UPDATE [Test] SET [Price] = @Price, [Quantity] = @Quantity WHERE (([ID] = @Original_ID)); select [ID], [Price], [Quantity], [Total] from [Test]  where [ID] = SCOPE_IDENTITY()";
        
        p = UpdateCommand.Parameters.Add("@Price", SqlDbType.Money);
        p.SourceColumn = "Price";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Quantity", SqlDbType.Money);
        p.SourceColumn = "Quantity";
        p.SourceVersion = DataRowVersion.Current;
        p = UpdateCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;

        // DeleteCommand
        this.DeleteCommand.CommandText = "DELETE FROM [Test] WHERE (([ID] = @Original_ID))";
        
        p = DeleteCommand.Parameters.Add("@Original_ID", SqlDbType.Int);
        p.SourceColumn = "ID";
        p.SourceVersion = DataRowVersion.Original;
    }
    #endregion
}     
      }
